const state = {
  // 顶部导航栏是否收起
  headerMenuHide: false,
  // 顶部导航栏数据
  headerMenuList: [
    {
      name: '有左侧导航栏',
      path: '/home',
      meta: {
        role: ['all']
      }
    },
    {
      name: '无左侧导航栏',
      path: '/template',
      meta: {
        role: ['all']
      }
    }

  ]
}
// 存放的方法
const mutations = {
  /**
     * @description: 修改headerMenuList数据
     * @param {*} state
     * @param {*} data vuex中用户信息
     * @return {*} null
     */
  updateHeaderMenuList (state, data) {
    const list = ['/siteInspectionHomeWork', '/siteInspectionHome']
    state.headerMenuList = state.headerMenuList.filter((menuItem) => menuItem.meta.role.includes(data.role))
    if (data.deptLevel > 3 && list.includes(state.headerMenuList[0].path)) {
      state.headerMenuList[0].path = '/siteInspectionHomeWork'
    } else if (data.deptLevel <= 3 && list.includes(state.headerMenuList[0].path)) {
      state.headerMenuList[0].path = '/siteInspectionHome'
    }
  }
}
const actions = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
